/**
 * 操作日志管理初始化
 */
var VpnOperationLog = {
    id: "VpnOperationLogTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
VpnOperationLog.initColumn = function () {
    return [[
        {title: '操作人', field: 'roleName', visible: true, align: 'center'},
        {title: '项目类别', field: 'itemName', visible: true, align: 'center'},
        {title: '内容', field: 'content', visible: true, align: 'center'},
        {title: '时间', field: 'createTime', visible: true, align: 'center'}
    ]];
};


/**
 * 打开查看操作日志详情
 */
VpnOperationLog.openVpnOperationLogDetail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: '操作日志详情',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/vpnOperationLog/vpnOperationLog_update/' + VpnOperationLog.seItem.id
        });
        this.layerIndex = index;
    }
};


VpnOperationLog.tableList = function(queryData){
    layui.use("table",function () {
        var table = layui.table;

        VpnOperationLog.table = table;

        table.render({
            elem: "#table",
            url: Feng.ctxPath +"/vpnOperationLog/list",
            cellMinWidth: 100,
            where: queryData,
            page: true,
            limit: 20,
            cols: VpnOperationLog.initColumn(),
            parseData: function(res){
                console.log(res);
                return{
                    "code":0,
                    "msg":"获取成功",
                    "count":res.total,
                    "data": res.items
                }
            },
            text: {
                none: '暂无相关数据'
            },
            id: "tableReload"
        });
    });
};


$(function () {
    VpnOperationLog.tableList(null);
});
